<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\talent\controller;

use plugin\saiadmin\basic\BaseController;
use app\talent\logic\talentLogic;
use app\talent\validate\talentValidate;
use support\Request;
use support\Response;

/**
 * 人才列表控制器
 */
class talentController extends BaseController
{
    /**
     * 数据表主键
     */
    protected $pk = 'talent_id';
    
    /**
     * 构造函数
     */
    public function __construct()
    {
        $this->logic = new talentLogic();
        $this->validate = new talentValidate;
        parent::__construct();
    }

    /**
     * 数据列表
     * @param Request $request
     * @return Response
     */
    public function index(Request $request): Response
    {
        $where = $request->more([
            ['name', ''],
            ['gender', ''],
            ['contact_number', ''],
            ['domicile', ''],
            ['current_residence', ''],
            ['education_level', ''],
            ['english_level', ''],
            ['update_time', ''],
        ]);
        $query = $this->logic->search($where);
        $data = $this->logic->getList($query);

        return $this->success($data);
    }
     public function export(Request $request) : Response
    {
       
         $where = $request->more([
            ['name', ''],
            ['gender', ''],
            ['contact_number', ''],
            ['domicile', ''],
            ['current_residence', ''],
            ['education_level', ''],
            ['english_level', ''],
            ['update_time', '']
        ]);
        return $this->logic->export($where);
    }
}
